<?php
accessPage(1);
my_component_load('testing' , false);
my_component_load('paging' , false);
my_component_load('jabatan_existing', false);
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id= isset( $_GET['id'] ) ? $_GET['id']:  0;
$facebox=true ; 

$modulname = "Personalia _BN_ Penempatan _BN_ Organisasi _BN_ Existing";
if($_SERVER['REQUEST_METHOD'] == "POST" ):
    $validatepost = form_jabatan_existing_validate($id);
	if($validatepost){
		$content = message_multi_error($validatepost);
		$content .= form_jabatan_existing_create($id);
		if($facebox){
			generate_my_web($content,"","plain.php");
			exit; 
		}else{
			$pagename = $modulname;
			generate_my_web($content, $pagename  );		
		}	
		
	}else{
		form_jabatan_existing_submit($id);
		if($facebox){
			$content =  "Updated";
			generate_my_web($content,"","plain.php");
			exit;
		}	
	}
	my_direct('index.php?com=jabatan_existing');
	break;
else: 
	if($task == 'page'){
		$content  = form_jabatan_existing_create($id);
		generate_my_web($content,"","plain.php");
		exit; 	
	}elseif($task =='edit'){
		$pagename= ($id > '0' ) ?  "Perubahan Data" : "Tambah Data";
		if($facebox){
			facebox_page('index.php?com=jabatan_existing&task=page&id='.$id , $pagename , 250	); 			
		}else{				
			$content  = form_jabatan_existing_create($id);
			generate_my_web($content, $pagename  );	
		}
	}else{
		$pagename = $modulname;
		load_facebox_script();	
		$view = list_jabatan_existing();
		generate_my_web($view, $pagename );
	}
endif;  

?>